package main

import "fmt"

func main() {
	for {
		var n int
		_, err := fmt.Scan(&n)
		if err != nil || n == 0 {
			return
		}
		var res int
		for i := 0; i < n; i++ {
			var n int
			_, _ = fmt.Scan(&n)
			res += n
		}
		fmt.Println(res)
	}
}

func bag2(weight, value []int, bagWeight int) int {
	var dp [][]int
	for i := 0; i <= len(weight); i++ {
		dp = append(dp, make([]int, bagWeight+1))
	}

	for i := 1; i <= len(weight); i++ {
		for j := 0; j <= bagWeight; j++ {
			if j < weight[i-1] {
				dp[i][j] = dp[i-1][j]
			} else {
				dp[i][j] = Max4(dp[i-1][j], dp[i-1][j-weight[i-1]]+value[i-1])
			}
		}
	}

	return dp[len(weight)][bagWeight]
}

func Max4(a, b int) int {
	if a < b {
		return b
	}
	return a
}
